﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TypeControl.ascx.cs" Inherits="RainyPWS.Web.Admin.controls.TypeControl" %>
<script src="../../Scripts/jquery-1.6.1.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("ul.typeItems li").bind("mouseenter", function () {
            $("div", $(this)).show();
        });
        $("ul.typeItems li").bind("mouseleave", function () {
            $("div", $(this)).hide();
        });
        $("a#t<%=TypeID %>").addClass("selected");
    });
    function DeleteRecordType(id) {
        if (window.confirm('确认删除该类型吗？')) {
            var url = '<%=Page.ResolveUrl("~/CommonHandler/RecordHandler.ashx") %>';
            $.ajax({
                type: 'post',
                url: url,
                data: 'act=deleterecordtype&id=' + id,
                success: function (result) {
                    var obj = $.parseJSON(result);
                    if (obj == null) {
                        alert("删除失败");
                        return;
                    }
                    if (obj.result == 'ok') {
                        location.href = location.href;
                    } else {
                        alert(obj.msg);
                    }
                }
            });
        }
    }
</script>
<div style="padding:5px;">
    <div class="typeHeader">
        <h1><asp:Label ID="lblName" runat="server" Text="分类"></asp:Label></h1>
        <div>
            <asp:HyperLink ID="hlAdd" runat="server" NavigateUrl="javascript:AddRecordType();">添加分类</asp:HyperLink>
        </div>
    </div>
    <ul class="typeItems">
        <li>
            <a id="t0" href="RecordManage.aspx">所有日志</a>
        </li>
        <li>
            <a id="t-1" href="RecordManage.aspx?tid=-1">回收站</a>
        </li>
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <li>
                    <a id="t<%# Eval("ID") %>" href="RecordManage.aspx?tid=<%# Eval("Id") %>" title="<%# Eval("Remark") %>"><%# Eval("Name") %></a>(<%# Eval("Count") %>)
                    <div><a href="javascript:EditRecordType(<%# Eval("Id") %>)" title="编辑"><img src="images/edit_16.png" alt="" /></a>&nbsp;<a href="javascript:DeleteRecordType(<%# Eval("ID") %>)" title="删除"><img src="images/delete.png" alt="删除" /></a></div>
                </li>
            </ItemTemplate>
        </asp:Repeater>
    </ul>
</div>